import { Global, Module, DynamicModule } from "@nestjs/common";



type ConfigOptions = {
  path:string
}
@Global()
@Module({

})

export class ConfigModule {
  static forRoot(options:ConfigOptions): DynamicModule {
     return {
       module:ConfigModule,
       providers:[
         {
           provide:'Config',
           useValue:{baseUrl:'/api' + options.path}
         }
       ],
       exports:[{
         provide:'Config',
         useValue:{baseUrl:'/api' + options.path}
       }]
     }
  }
}
